%plot the number of iterations
function plotconv3(dir,m,prefs,exp)
data1=load(strcat(dir,'\m',int2str(m),'_n2_d2_',prefs,'.all.results'));
data2=load(strcat(dir,'\m',int2str(m),'_n3_d2_',prefs,'.all.results'));
data3=load(strcat(dir,'\m',int2str(m),'_n5_d2_',prefs,'.all.results'));
data4=load(strcat(dir,'\m',int2str(m),'_n10_d2_',prefs,'.all.results'));
num=length(data1);
numblocks=data1(num,2)+1;
row=exp*numblocks+numblocks;
col=14;
err=15;
y1=[data1(row,col),data2(row,col),data3(row,col),data4(row,col)];
e1=[data1(row,err),data2(row,err),data3(row,err),data4(row,err)];

data1=load(strcat(dir,'\m',int2str(m),'_n2_d2_',prefs,'.all.results'));
data2=load(strcat(dir,'\m',int2str(m),'_n2_d3_',prefs,'.all.results'));
data3=load(strcat(dir,'\m',int2str(m),'_n2_d5_',prefs,'.all.results'));
data4=load(strcat(dir,'\m',int2str(m),'_n2_d10_',prefs,'.all.results'));
y2=[data1(row,col),data2(row,col),data3(row,col),data4(row,col)];
e2=[data1(row,err),data2(row,err),data3(row,err),data4(row,err)];


x=[2,3,5,10];
%a1 = x0:(x1-x0)/10:x1;


%for a1=.4
%g=1.5
lw=2;
fs=12;
set(gca,'FontSize',fs);
errorbar(x,y1,e1,'r','LineWidth', lw);
hold on;
h1=errorbar(x,y2,e2,'m','LineWidth', lw);
xlim([2 10]);
%ylim([0 20]);
%plot(x,y,'LineWidth', lw);
legend('numbidders', 'numdiscrbids');
xlabel('number of bidders/discrete bids', 'FontSize', fs);
ylabel('num. iterations to converge', 'FontSize', fs);
title('Number of Iterations to Converge');
hold off;

name = strcat('./conv_m',int2str(m),'_e',int2str(exp),'_',prefs);
print('-depsc',strcat(name, '.eps'));
%print('-dpdf',strcat(name, '.pdf'));
end

